package com.hky.algorithm.mahjongGame;

import com.hky.algorithm.mahjongGame.constent.Protocol;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.util.Objects;

@AllArgsConstructor
@NoArgsConstructor
@ToString
public class ProtocolItem {
    public Protocol protocol;
    public Object data;
    public String dataString;

    public ProtocolItem(Protocol protocol) {
        this.protocol = protocol;
    }

    public ProtocolItem(Protocol protocol, Object data) {
        this.protocol = protocol;
        this.data = data;
    }

    public ProtocolItem(Protocol protocol, String dataString) {
        this.protocol = protocol;
        this.dataString = dataString;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ProtocolItem that = (ProtocolItem) o;
        return protocol == that.protocol && Objects.equals(data, that.data) && Objects.equals(dataString, that.dataString);
    }

    @Override
    public int hashCode() {
        return Objects.hash(protocol, data, dataString);
    }
}
